<?php

use yii\helpers\Html;
use yii\grid\GridView;

/* @var $this yii\web\View */
/* @var $searchModel backend\models\NoticeSearch */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = '通知消息列表';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="banner-index col-sm-12" style="margin-top: 15px;">
    <p>
        <?= Html::a('新建通知消息', ['create'], ['class' => 'btn btn-success']) ?>
    </p>
    <div class="ibox ibox-content float-e-margins">
        <?php echo $this->render('_search', ['model' => $searchModel]); ?>
        <?= GridView::widget([
            'dataProvider' => $dataProvider,
            'tableOptions' => ['class' => 'table table-striped'],
//            'options' => ['class' => 'grid-view', 'style' => 'overflow:auto', 'id' => 'grid'],
//            'filterModel' => $searchModel,
            'columns' => [
//                [
//                    'class' => \yii\grid\CheckboxColumn::className(),
//                    'name' => 'id',  //设置每行数据的复选框属性
//                ],
                "id",
                "title",
                "sub_title",
                [
                    'attribute' => 'created_at',
                    'value' => function ($m) {
                        return date('Y-m-d H:i:s', $m->created_at);
                    }
                ],
                [
                    'class' => 'yii\grid\ActionColumn',
                    'header' => '操作',
                    'headerOptions' => ['width'=>'150px'],
                    'template' => '{update} {delete}',
                    'buttons' => [
                        'update' => function($url, $model, $key){
                            return Html::a('修改', $url,['class' =>'btn btn-outline btn-info btn-xs']);
                        },
                        'delete' => function($url, $model, $key){
                            return Html::a('删除', $url,['data-confirm' => '你确定要删除吗?','data-method' => 'POST','class' =>'btn btn-outline btn-danger btn-xs']);
                        },
                    ],
                ],
            ],
        ]); ?>
    </div>
</div>